// pages/tabBar/tabBar.js
Component({
  
  /**
   * 组件的属性列表
   */
  properties: {
    status: String ,// 简化的定义方式
    tabBarIndex: String
  },

  /**
   * 组件的初始数据
   */
  data: {
    status: 0,//0为管理员，1为用户 and 部门管理员
    tabBarIndex: 0,
    tabBarAdmin: [
      {
        "pagePath": "/pages/index/index",
        "text": "首页",
        "iconPath": "/images/tabBar/tab01.png",
        "selectedIconPath": "/images/tabBar/tab11.png"
      },
      {
        "pagePath": "/pages/admin/department/departIndex/departIndex",
        "text": "部门",
        "iconPath": "/images/tabBar/tab02.png",
        "selectedIconPath": "/images/tabBar/tab22.png"
      },
      {
        "pagePath": "/pages/admin/putIn/putInIndex/putInIndex",
        "text": "投放",
        "iconPath": "/images/tabBar/tab03.png",
        "selectedIconPath": "/images/tabBar/tab33.png"
      },
      {
        "pagePath": "/pages/admin/income/incomeIndex/incomeIndex",
        "text": "收益",
        "iconPath": "/images/tabBar/tab04.png",
        "selectedIconPath": "/images/tabBar/tab44.png"
      }
    ],
    tabBarUser: [
      {
        "pagePath": "/pages/index/index",
        "text": "首页",
        "iconPath": "/images/tabBar/tab01.png",
        "selectedIconPath": "/images/tabBar/tab11.png"
      },
      {
        "pagePath": "/pages/user/putInPoint/pointIndex/pointIndex",
        "text": "投放点",
        "iconPath": "/images/tabBar/tab05.png",
        "selectedIconPath": "/images/tabBar/tab55.png"
      },
      {
        "pagePath": "/pages/user/find/findIndex/findIndex",
        "text": "发现",
        "iconPath": "/images/tabBar/tab06.png",
        "selectedIconPath": "/images/tabBar/tab66.png"
      },
      {
        "pagePath": "/pages/user/user/userIndex/userIndex",
        "text": "我的",
        "iconPath": "/images/tabBar/tab07.png",
        "selectedIconPath": "/images/tabBar/tab77.png"
      }
    ]
  },

  /**
   * 组件的方法列表
   */
  methods: {
    //底部tabBar跳转函数
    tabBarJump: function(e) {
      var that = this;
      var tabIndex = e.currentTarget.dataset.index;
      var tabBarIndex = that.data.tabBarIndex;
      var pagePath = e.currentTarget.dataset.url;
      if(tabIndex == tabBarIndex){
        return;
      }else{
        wx.redirectTo({
          url: pagePath,
        })
      }
    },
  }
})
